Skip to content

refactor: move storage schema component into a separate file#2603

Merged
bobbinth merged 4 commits intonextfrom
bobbin-account-schema
Mar 17, 2026
Merged

refactor: move storage schema component into a separate file#2603
bobbinth merged 4 commits intonextfrom
bobbin-account-schema

Conversation

@bobbinth
Copy link
Contributor

This PR moves the AccountSchemaComponent into a separate module. The main intent here is to make the diff in #2439 smaller, but it also fixes a couple of things in the component (see inline comments).

Comment on lines -104 to -110
static STORAGE_SCHEMA_LIBRARY: LazyLock<Library> = LazyLock::new(|| {
let bytes = include_bytes!(concat!(
env!("OUT_DIR"),
"/assets/account_components/metadata/schema_commitment.masl"
));
Library::read_from_bytes(bytes).expect("Shipped Storage Schema library is well-formed")
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should start moving these into their corresponding module, and eventually, try to get rid of the StandardAccountComponent (I may be forgetting something, but it is not clear to me why we need it).

Comment on lines +61 to +63
/// Name of the component is set to match the path of the corresponding module in the standards
/// library.
const NAME: &str = "miden::standards::metadata::storage_schema";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name of the component to be the same as its module path in the standards library.

Comment on lines +36 to +39
static SCHEMA_COMMITMENT_SLOT_NAME: LazyLock<StorageSlotName> = LazyLock::new(|| {
StorageSlotName::new("miden::standards::metadata::storage_schema::commitment")
.expect("storage slot name should be valid")
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, changed the name of the storage slot to make it consistent with the name of the component.

Comment on lines +115 to +116
AccountComponent::new(STORAGE_SCHEMA_LIBRARY.clone(), storage, metadata)
.expect("AccountSchemaCommitment is a valid account component")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like AccountComponent::new() does not verify consistency between storage and metadata. @igamigo - is this intentional? If not, let's create an issue and fix it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was intentional. I'll create an issue to track this.

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I did not re-review most of the component, assuming it was moved.

@bobbinth
Copy link
Contributor Author

I'll merge this as is. @igamigo - would still be good if you could take a look at this, especially at #2603 (comment) and #2603 (comment).

@bobbinth bobbinth merged commit eeda9e6 into next Mar 17, 2026
17 checks passed
@bobbinth bobbinth deleted the bobbin-account-schema branch March 17, 2026 17:57
@igamigo
Copy link
Collaborator

igamigo commented Mar 17, 2026

I'll merge this as is. @igamigo - would still be good if you could take a look at this, especially at #2603 (comment) and #2603 (comment).

Sorry, had a pending review from yesterday but wanted to review what was there and what wasn't in terms of validations for this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants